<template>
	<div :id="dyid" style="width: 400px; height:570px;float: left;"></div>
</template>

<script>
	import * as echarts from 'echarts'
	export default {
		props: {
			dyid: String,
			title: String,
			rosedata: Array
		},
		data() {
			return {
				mychart: "",
				option:{},
			}

		},
		mounted() {
			this.option = {
				title: {
					text: this.title
				},
				legend: {
					top: 'bottom'
				},
				toolbox: {
					show: true,
					feature: {
						mark: {
							show: true
						},
						dataView: {
							show: true,
							readOnly: false
						},
						restore: {
							show: true
						},
						saveAsImage: {
							show: true
						}
					}
				},
				series: [{
					name: '面积模式',
					type: 'pie',
					radius: [30, 150],
					center: ['50%', '50%'],
					roseType: 'area',
					emphasis: {
						label: {
							show: true,
							fontSize: '15',
							fontWeight: 'bold'
						}
					},
					itemStyle: {
						borderRadius: 8
					},
					data: this.rosedata
				}]
			}
			this.mychart = echarts.init(document.getElementById(this.dyid))
			this.mychart.setOption(this.option)
		},
		watch:{
			rosedata:{
				handler(nd){
					this.option.series[0].data=nd
					this.mychart.setOption(this.option)
				},
				deep:true
			}
		}
	}
</script>

<style>
</style>
